package com.xiashitech.agent.instrumentation.spring.controller.apicapture.inst;

import com.xiashitech.agent.dto.UserRequest;
import com.xiashitech.interfaces.agent.dto.api.Api;
import com.xiashitech.agent.instrumentation.spring.controller.apicapture.inst.v_3_1.ApiGenerate_V_3_1;

public class ApiGenerate {
    public static Api generateApi(UserRequest userRequest) {
        if(userRequest == null || userRequest.getAdviceObject() == null || userRequest.getRequest() == null) {
            return null;
        }
        //3.1以后版本
        if(userRequest.getAdviceObject().getClass().getName().equals("org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod")) {
            return ApiGenerate_V_3_1.generateApi(userRequest);
        }
        //todo:3.1之前版本
        return null;
    }
}
